#pragma once

#include <atomic>

class Lockable
{
private:
	std::atomic<bool> LockStatus;

public:
	Lockable(void) :
		LockStatus(false)
	{
	}

	~Lockable(void)
	{
	}

	inline void Lock(void)
	{
		Retry:;
		if (LockStatus.exchange(true))
			goto Retry;
	}

	inline void Unlock(void)
	{
		LockStatus = false; // unlock
	}
};